﻿Imports Microsoft.VisualBasic
Imports System.Data.SqlClient

Public Class WebConfigServer
    ''
    'Public Shared Function CreateWebConfigFromReader(ByVal reader As SqlDataReader) As Dictionary(Of String, Object)
    '    Dim dictObjectWebConfig As New Dictionary(Of String, Object)
    '    Try
    '        Util.SetDictionaryValueByKey(dictObjectWebConfig, "PID", (reader("PID")))
    '        Util.SetDictionaryValueByKey(dictObjectWebConfig, "PTitle", (reader("PTitle")))
    '        Util.SetDictionaryValueByKey(dictObjectWebConfig, "PDesc", (reader("PDesc")))
    '        Util.SetDictionaryValueByKey(dictObjectWebConfig, "PImg", (reader("PImg")))
    '        Util.SetDictionaryValueByKey(dictObjectWebConfig, "PCreateDay", (reader("PCreateDay")))
    '        Util.SetDictionaryValueByKey(dictObjectWebConfig, "PContent", (reader("PContent")))
    '        Util.SetDictionaryValueByKey(dictObjectWebConfig, "PCID", (reader("PCID")))
    '    Catch ex As Exception
    '    End Try
    '    Return dictObjectWebConfig
    'End Function


    Public Shared Function GetValueWebConfigByKey(ByVal key As String) As String
        Dim value As String = ""
        Try
            Dim sql As String = "SELECT isNull(WValue1,'') WValue1 FROM WebConfig where WDisplay='1' and wkey='" + key + "'"
            Dim reader As SqlDataReader
            reader = Connection.ExcuteReader(sql)
            While (reader.Read())
                value = reader("WValue1")
            End While
            reader.Close()
            Connection.Dispose()
        Catch ex As Exception
            Connection.CheckCloseConnect()
            ''Throw ex
        End Try
        Return value
    End Function

End Class
